-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): add gradle plugin (nrwl#21055)
- Loading branch information
Showing
28 changed files
with
998 additions
and
0 deletions.
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
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
Validating CODEOWNERS rules …
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,14 @@ | ||
/* eslint-disable */ | ||
export default { | ||
transform: { | ||
'^.+\\.[tj]sx?$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }], | ||
}, | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'], | ||
maxWorkers: 1, | ||
globals: {}, | ||
globalSetup: '../utils/global-setup.ts', | ||
globalTeardown: '../utils/global-teardown.ts', | ||
displayName: 'e2e-gradle', | ||
testTimeout: 600000, | ||
preset: '../../jest.preset.js', | ||
}; |
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,10 @@ | ||
{ | ||
"name": "e2e-gradle", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "e2e/gradle", | ||
"projectType": "application", | ||
"targets": { | ||
"e2e": {} | ||
}, | ||
"implicitDependencies": ["eslint"] | ||
} |
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,87 @@ | ||
import { | ||
checkFilesExist, | ||
cleanupProject, | ||
createFile, | ||
e2eConsoleLogger, | ||
newProject, | ||
runCLI, | ||
runCommand, | ||
uniq, | ||
updateFile, | ||
updateJson, | ||
} from '@nx/e2e/utils'; | ||
import { execSync } from 'child_process'; | ||
|
||
describe('Gradle', () => { | ||
let gradleProjectName = uniq('my-gradle-project'); | ||
|
||
beforeAll(() => { | ||
newProject(); | ||
createGradleProject(gradleProjectName); | ||
}); | ||
afterAll(() => cleanupProject()); | ||
|
||
it('should build', () => { | ||
const projects = runCLI(`show projects`); | ||
expect(projects).toContain('app'); | ||
expect(projects).toContain('list'); | ||
expect(projects).toContain('utilities'); | ||
expect(projects).toContain(gradleProjectName); | ||
|
||
const buildOutput = runCLI('build app', { verbose: true }); | ||
// app depends on list and utilities | ||
expect(buildOutput).toContain('nx run list:build'); | ||
expect(buildOutput).toContain('nx run utilities:build'); | ||
|
||
checkFilesExist( | ||
`app/build/libs/app.jar`, | ||
`list/build/libs/list.jar`, | ||
`utilities/build/libs/utilities.jar` | ||
); | ||
}); | ||
|
||
it('should track dependencies for new app', () => { | ||
createFile( | ||
'app2/build.gradle.kts', | ||
` | ||
plugins { | ||
id("gradleProject.kotlin-application-conventions") | ||
} | ||
dependencies { | ||
implementation(project(":app")) | ||
} | ||
` | ||
); | ||
updateFile(`settings.gradle.kts`, (content) => { | ||
content += `\r\ninclude("app2")`; | ||
return content; | ||
}); | ||
const buildOutput = runCLI('build app2', { verbose: true }); | ||
// app2 depends on app | ||
expect(buildOutput).toContain('nx run app:build'); | ||
}); | ||
}); | ||
|
||
function createGradleProject(projectName: string) { | ||
e2eConsoleLogger(`Using java version: ${execSync('java --version')}`); | ||
e2eConsoleLogger(`Using gradle version: ${execSync('gradle --version')}`); | ||
e2eConsoleLogger(execSync(`gradle help --task :init`).toString()); | ||
e2eConsoleLogger( | ||
runCommand( | ||
`gradle init --type kotlin-application --dsl kotlin --project-name ${projectName} --package gradleProject --no-incubating --split-project` | ||
) | ||
); | ||
updateJson('nx.json', (nxJson) => { | ||
nxJson.plugins = ['@nx/gradle']; | ||
return nxJson; | ||
}); | ||
createFile( | ||
'build.gradle.kts', | ||
`allprojects { | ||
apply { | ||
plugin("project-report") | ||
} | ||
}` | ||
); | ||
} |
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,13 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"types": ["node", "jest"] | ||
}, | ||
"include": [], | ||
"files": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.spec.json" | ||
} | ||
] | ||
} |
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,20 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../dist/out-tsc", | ||
"module": "commonjs", | ||
"types": ["jest", "node"] | ||
}, | ||
"include": [ | ||
"**/*.test.ts", | ||
"**/*.spec.ts", | ||
"**/*.spec.tsx", | ||
"**/*.test.tsx", | ||
"**/*.spec.js", | ||
"**/*.test.js", | ||
"**/*.spec.jsx", | ||
"**/*.test.jsx", | ||
"**/*.d.ts", | ||
"jest.config.ts" | ||
] | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,37 @@ | ||
{ | ||
"extends": ["../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.json"], | ||
"parser": "jsonc-eslint-parser", | ||
"rules": { | ||
"@nx/dependency-checks": [ | ||
"error", | ||
{ | ||
"ignoredDependencies": ["nx"] | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"files": ["./package.json"], | ||
"parser": "jsonc-eslint-parser", | ||
"rules": { | ||
"@nx/nx-plugin-checks": "error" | ||
} | ||
} | ||
] | ||
} |
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,18 @@ | ||
<p style="text-align: center;"> | ||
<picture> | ||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg"> | ||
<img alt="Nx - Smart Monorepos · Fast CI" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%"> | ||
</picture> | ||
</p> | ||
|
||
{{links}} | ||
|
||
<hr> | ||
|
||
# Nx: Smart Monorepos · Fast CI | ||
|
||
Nx is a build system with built-in tooling and advanced CI capabilities. It helps you maintain and scale monorepos, both locally and on CI. | ||
|
||
This package is a [Gradle plugin for Nx](https://nx.dev/gradle/overview). | ||
|
||
{{content}} |
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 @@ | ||
export * from './plugin'; |
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,10 @@ | ||
/* eslint-disable */ | ||
export default { | ||
transform: { | ||
'^.+\\.[tj]sx?$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }], | ||
}, | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html', 'json'], | ||
globals: {}, | ||
displayName: 'gradle', | ||
preset: '../../jest.preset.js', | ||
}; |
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,4 @@ | ||
{ | ||
"generators": {}, | ||
"packageJsonUpdates": {} | ||
} |
Oops, something went wrong.