This repository has been archived by the owner on Jul 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Added support for gradle projects #85
Open
RobotHanzo
wants to merge
106
commits into
TheBusyBiscuit:gh-pages
Choose a base branch
from
RobotHanzo:gh-pages
base: gh-pages
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
106 commits
Select commit
Hold shift + click to select a range
c58d4ae
An attempt on supporting gradle based
RobotHanzo 045895b
Debugging
RobotHanzo 9854808
Debugging
RobotHanzo d88a845
Debugging
RobotHanzo 869da1e
Debugging
RobotHanzo 1561d20
Switched order for Debugging
RobotHanzo 0601f52
Fixes
RobotHanzo 52e3bdf
Change debugging repo
RobotHanzo d7bcd66
Changed to repo
RobotHanzo d3e5c99
Successfully compiled: RobotHanzo/BusyBiscuitBuilderTestRepo:master (1)
d187827
Make `job` writable
RobotHanzo fe3861a
Merge remote-tracking branch 'origin/gh-pages' into gh-pages
RobotHanzo 31c4320
Auto-Formatter
RobotHanzo acbb250
Make logging work
RobotHanzo 0d35bdb
Require build tool to be specified
RobotHanzo a5c06f3
fixing
RobotHanzo 39356d8
Fix attempt
RobotHanzo f8d6acd
debug logs
RobotHanzo 4b9cb97
You gotta resolve()
RobotHanzo 945de76
Failed to compile: RobotHanzo/BusyBiscuitBuilderTestRepo:gradle (1)
24d06b6
Escape chars
RobotHanzo 4cfb223
Merge remote-tracking branch 'origin/gh-pages' into gh-pages
RobotHanzo 28a0d44
Auto-Formatter
RobotHanzo c870374
Force recompile
RobotHanzo 3283314
Merge remote-tracking branch 'origin/gh-pages' into gh-pages
RobotHanzo ba488dd
Failed to compile: RobotHanzo/BusyBiscuitBuilderTestRepo:gradle (1)
a903277
JS outdated
RobotHanzo 8636e87
Merge remote-tracking branch 'origin/gh-pages' into gh-pages
RobotHanzo 0d593d5
Force recompiling
RobotHanzo 556b742
Failed to compile: RobotHanzo/BusyBiscuitBuilderTestRepo:gradle (1)
4c0f87d
ABS path
RobotHanzo f9dad25
Merge remote-tracking branch 'origin/gh-pages' into gh-pages
RobotHanzo 2dd9ca9
Force recomp.
RobotHanzo 053b96d
Failed to compile: RobotHanzo/BusyBiscuitBuilderTestRepo:gradle (1)
35cfd93
attempt
RobotHanzo ee3d2ec
Merge remote-tracking branch 'origin/gh-pages' into gh-pages
RobotHanzo 3dd23c9
force rec.
RobotHanzo c4e29a7
Failed to compile: RobotHanzo/BusyBiscuitBuilderTestRepo:gradle (1)
a938d97
grant perms
RobotHanzo 98e92c2
Merge remote-tracking branch 'origin/gh-pages' into gh-pages
RobotHanzo 27c83c0
f. rec
RobotHanzo d0fc4c8
Auto-Formatter
RobotHanzo 3e8f3da
Check
RobotHanzo 2a34f12
Merge remote-tracking branch 'origin/gh-pages' into gh-pages
RobotHanzo 136a07d
Auto-Formatter
RobotHanzo b9c62ae
fix
RobotHanzo 820502a
Merge remote-tracking branch 'origin/gh-pages' into gh-pages
RobotHanzo 335814a
use gradle.properties
RobotHanzo 4e64eb4
Auto-Formatter
RobotHanzo 55e3293
Fix renaming
RobotHanzo 2df8094
Merge remote-tracking branch 'origin/gh-pages' into gh-pages
RobotHanzo ad5afac
Auto-Formatter
RobotHanzo c11b9ed
Successfully compiled: RobotHanzo/BusyBiscuitBuilderTestRepo:gradle (1)
8611df9
Restored debugging leftovers
RobotHanzo 1cd2a54
Merge remote-tracking branch 'origin/gh-pages' into gh-pages
RobotHanzo 1bdf1e2
More leftovers
RobotHanzo 5092e3f
Make the tests compatible
RobotHanzo 2cdd81b
Fixes
RobotHanzo f8239dc
Separate files
RobotHanzo 704bb80
Typo
RobotHanzo 84d7482
Use jitpack
RobotHanzo 1e7e75a
Creates file if not exists
RobotHanzo 68afe93
Auto-Formatter
RobotHanzo 0a4467f
Give us the logs
RobotHanzo 55bf84c
Merge remote-tracking branch 'origin/gh-pages' into gh-pages
RobotHanzo 3253cce
Fix attempt
RobotHanzo 4b1998e
Fix paths
RobotHanzo fc4ec20
Add prefix
RobotHanzo c154fe6
settings.gradle generator
RobotHanzo a6bbb9f
settings.gradle generator
RobotHanzo 92d280b
Another way
RobotHanzo 8d0bb2a
Another way
RobotHanzo 9fdc6b7
Typo sucks
RobotHanzo 213801d
Attempt on copying TestMaven.js for test
RobotHanzo 5b1a102
import the stuff
RobotHanzo c5208ce
Ensure folder exists
RobotHanzo 080fc26
New lines fixed
RobotHanzo e584720
New lines fixed
RobotHanzo 3f253b2
No async
RobotHanzo b53f29d
use variable in string
RobotHanzo 6faf99f
use +x instead of a+x
RobotHanzo d74a4f5
variable in string
RobotHanzo 8427051
default to maven if not specified
RobotHanzo f3886da
variable in string
RobotHanzo 3d452ef
remove the use of having to escape characters
RobotHanzo 4cba9bf
variable in string
RobotHanzo 68d33ff
variable in string
RobotHanzo e65e172
optimize code
RobotHanzo a77f91c
variable in string
RobotHanzo 05d5491
dont need extra comparision
RobotHanzo 655845d
variable in string
RobotHanzo f840689
default to maven if not specified
RobotHanzo 2dddef1
dont need extra comparision
RobotHanzo 60447da
default to maven if not specified
RobotHanzo 8ca676f
Auto-Formatter
RobotHanzo 65f7791
default to maven
RobotHanzo 45ae4c2
Merge remote-tracking branch 'origin/gh-pages' into gh-pages
RobotHanzo cc1d1e4
fixes
RobotHanzo 3ef9b3e
optimized if
RobotHanzo 9fff35f
Auto-Formatter
RobotHanzo e7802b5
node version issues
RobotHanzo 43885c9
Merge remote-tracking branch 'origin/gh-pages' into gh-pages
RobotHanzo 7577454
actual fix
RobotHanzo b54a187
node 12 doesnt support many things
RobotHanzo 86c9a6d
use the old way to ensure everything works
RobotHanzo 9676202
Merge branch 'TheBusyBiscuit:gh-pages' into gh-pages
RobotHanzo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1062,7 +1062,6 @@ | |
} | ||
} | ||
}, | ||
|
||
"John000708/SlimeXpansion:master": { | ||
"sonar": { | ||
"enabled": false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
const process = require('child-process-promise') | ||
const lodash = require('lodash/lang') | ||
|
||
const FileSystem = require('fs') | ||
const fs = FileSystem.promises | ||
const path = require('path') | ||
|
||
const log = require('../src/logger.js') | ||
const projects = require('../src/projects.js') | ||
|
||
module.exports = { | ||
getGradleArguments, | ||
setVersion, | ||
compile, | ||
relocate, | ||
isValid | ||
} | ||
|
||
/** | ||
* This will return the console line arguments for gradle.compile() | ||
* | ||
* @return {Array<String>} The needed console line arguments | ||
*/ | ||
function getGradleArguments () { | ||
return ['build'] | ||
} | ||
|
||
/** | ||
* This method changes the project's version in your gradle.properties file | ||
* It also returns a Promise that resolves when it's done. | ||
* | ||
* @param {Object} job The currently handled Job Object | ||
* @param {String} version The Version that shall be set | ||
*/ | ||
function setVersion (job, version) { | ||
return new Promise((resolve, reject) => { | ||
if (!isValid(job)) { | ||
reject(new Error('Invalid Job')) | ||
return | ||
} | ||
const file = path.resolve(__dirname, `../${job.directory}/files/gradle.properties`) | ||
if (!FileSystem.existsSync(file)) { | ||
fs.writeFile(file, '\nversion=' + version, 'utf8').then(resolve, reject) | ||
} else { | ||
fs.readFile(file, 'utf8').then((data) => { | ||
const content = data.split('\n') | ||
const result = [] | ||
let line | ||
for (line in content) { | ||
if (!line.includes('version=')) { | ||
result.push(line) | ||
} | ||
} | ||
result.push('\nversion=' + version) | ||
fs.writeFile(file, result, 'utf8').then(resolve, reject) | ||
}, reject) | ||
} | ||
}) | ||
} | ||
|
||
/** | ||
* This method will compile a project using the command | ||
* 'gradlew build' | ||
* | ||
* @param {Object} job The currently handled Job Object | ||
* @param {Boolean} logging Whether the internal activity should be logged | ||
* @return {Promise} A promise that resolves when this activity finished | ||
*/ | ||
function compile (job, logging) { | ||
return new Promise((resolve, reject) => { | ||
if (!isValid(job)) { | ||
reject(new Error('Invalid Job')) | ||
return | ||
} | ||
|
||
log(logging, '-> Granting gradlew +x permissions') | ||
|
||
process.spawn('chmod', ['+x', 'gradlew'], { | ||
cwd: path.resolve(__dirname, `../${job.directory}/files`), | ||
shell: true | ||
}) | ||
|
||
log(logging, "-> Executing './gradlew build'") | ||
|
||
const args = getGradleArguments() | ||
const compiler = process.spawn('./gradlew', args, { | ||
cwd: path.resolve(__dirname, `../${job.directory}/files`), | ||
shell: true | ||
}) | ||
|
||
const logger = (data) => { | ||
log(logging, data, true) | ||
fs.appendFile(path.resolve(__dirname, `../${job.directory}/${job.repo}-${job.id}.log`), data, 'utf8').catch(err => console.log(err)) | ||
} | ||
|
||
compiler.childProcess.stdout.on('data', logger) | ||
compiler.childProcess.stderr.on('data', logger) | ||
|
||
compiler.then(resolve, reject) | ||
}) | ||
} | ||
|
||
/** | ||
* This method will relocate a project's compiled jar file | ||
* to the appropriate directory | ||
* | ||
* @param {Object} job The currently handled Job Object | ||
* @return {Promise} A promise that resolves when this activity finished | ||
*/ | ||
function relocate (job) { | ||
if (!job.success) { | ||
return Promise.resolve() | ||
} | ||
return fs.rename( | ||
path.resolve(__dirname, `../${job.directory}/files/build/libs/${job.repo}-${(job.options ? job.options.prefix : 'DEV')} - ${job.id} (git ${job.commit.sha.substr(0, 8)}).jar`), | ||
path.resolve(__dirname, `../${job.directory}/${job.repo}-${job.id}.jar`) | ||
) | ||
} | ||
|
||
/** | ||
* This method will check if a Job is valid. | ||
* null / undefined or incomplete Job Objects will fail. | ||
* | ||
* @param {Object} job The job object to be tested | ||
* @return {Boolean} Whether the job is a valid Job | ||
*/ | ||
function isValid (job) { | ||
if (!projects.isValid(job)) return false | ||
return lodash.isInteger(job.id) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
git config user.name "TheBusyBot" | ||
git config user.email ${LOGIN_EMAIL} | ||
|
||
git remote set-url origin https://${ACCESS_TOKEN}@github.com/TheBusyBiscuit/builds.git | ||
git remote set-url origin https://${ACCESS_TOKEN}@github.com/TheBusyBiscuit/builds.git |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, can just do
fs/promises
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cant, theres one usage on fs.existSync