ninetwozero / gradle-to-js

A quick & dirty Gradle build file to JavaScript object parser
Apache License 2.0
47 stars 21 forks source link

Doesn't work for pattern dependency as array of object #17

Open dilipkumar2k6 opened 6 years ago

dilipkumar2k6 commented 6 years ago

I was testing and realized that it doesn't work when dependencies are defined as below.

runtime(
        [group: 'org.springframework', name: 'spring-core', version: '2.5'],
        [group: 'org.springframework', name: 'spring-aop', version: '2.5']
    )

Note: This is sample taken from https://docs.gradle.org/current/userguide/dependency_types.html

Following is complete input

plugins {
    // Apply the java-library plugin to add support for Java Library
    id 'java-library'
}

dependencies {
    runtime group: 'org.springframework', name: 'spring-core', version: '2.5'
    runtime 'org.springframework:spring-core:2.5',
            'org.springframework:spring-aop:2.5'
    runtime(
        [group: 'org.springframework', name: 'spring-core', version: '2.5'],
        [group: 'org.springframework', name: 'spring-aop', version: '2.5']
    )
    runtime('org.hibernate:hibernate:3.0.5') {
        transitive = true
    }
    runtime group: 'org.hibernate', name: 'hibernate', version: '3.0.5', transitive: true
    runtime(group: 'org.hibernate', name: 'hibernate', version: '3.0.5') {
        transitive = true
    }
}
task getHomeDir << {
    println gradle.gradleHomeDir
}

task(runSimple, dependsOn: 'classes', type: JavaExec) {
    main = 'Library'
    classpath = sourceSets.main.runtimeClasspath
    args 'mrhaki'
    systemProperty 'simple.message', 'Hello '
}

Following is complete output


{
        plugins: {id: 'java-library'},
        dependencies:
            [{
                group: 'org.springframework',
                name: 'spring-core',
                version: '2.5',
                type: 'runtime',
                excludes: []
            },
                {
                    group: 'org.springframework',
                    name: 'spring-core',
                    version: '2.5',
                    type: 'runtime',
                    excludes: []
                },
                {
                    group: 'org.springframework',
                    name: 'spring-aop',
                    version: '2.5',
                    type: 'org',
                    excludes: []
                },
                {
                    '': 'org.springframework',
                    name: 'spring-core',
                    version: '2.5]',
                    type: 'group',
                    excludes: []
                },
                {
                    '': 'org.springframework',
                    name: 'spring-aop',
                    version: '2.5]',
                    type: 'group',
                    excludes: []
                },
                {
                    group: 'org.hibernate',
                    name: 'hibernate',
                    version: '3.0.5',
                    type: 'runtime',
                    excludes: []
                },
                {
                    group: 'org.hibernate',
                    name: 'hibernate',
                    version: '3.0.5',
                    transitive: 'true',
                    type: 'runtime',
                    excludes: []
                },
                {
                    '': 'org.hibernate',
                    name: 'hibernate',
                    version: '3.0.5',
                    type: 'runtime',
                    excludes: []
                }],
        task: {println: 'gradle.gradleHomeDir'},
        '':
            {
                main: 'Library',
                classpath: 'sourceSets.main.runtimeClasspath',
                args: 'mrhaki',
                systemProperty: '\'simple.message\', \'Hello \''
            }
    }

Issue: Dependency is parsed as below

{
                    '': 'org.springframework',
                    name: 'spring-core',
                    version: '2.5]',
                    type: 'group',
                    excludes: []
                },
karllindmark commented 6 years ago

Hi Dilip!

Thanks for the really detailed report - I'll try to take a closer look at it towards the weekend (hopefully!). Lots of things happening in my life right now so I have had a rough time fitting this project in.

If you've got the time and feel like you'd like to contribute this fix, please let me know. Otherwise I'll try to squeeze it into my schedule together with #13. 😊

/Karl

On Tue, May 29, 2018, 00:34 Dilip notifications@github.com wrote:

I was testing and realized that it doesn't work when dependencies are defined as below.

runtime( [group: 'org.springframework', name: 'spring-core', version: '2.5'], [group: 'org.springframework', name: 'spring-aop', version: '2.5'] )

Note: This is sample taken from https://docs.gradle.org/current/userguide/dependency_types.html

Following is complete input

plugins { // Apply the java-library plugin to add support for Java Library id 'java-library' }

dependencies { runtime group: 'org.springframework', name: 'spring-core', version: '2.5' runtime 'org.springframework:spring-core:2.5', 'org.springframework:spring-aop:2.5' runtime( [group: 'org.springframework', name: 'spring-core', version: '2.5'], [group: 'org.springframework', name: 'spring-aop', version: '2.5'] ) runtime('org.hibernate:hibernate:3.0.5') { transitive = true } runtime group: 'org.hibernate', name: 'hibernate', version: '3.0.5', transitive: true runtime(group: 'org.hibernate', name: 'hibernate', version: '3.0.5') { transitive = true } } task getHomeDir << { println gradle.gradleHomeDir }

task(runSimple, dependsOn: 'classes', type: JavaExec) { main = 'Library' classpath = sourceSets.main.runtimeClasspath args 'mrhaki' systemProperty 'simple.message', 'Hello ' }

Following is complete output

{ plugins: {id: 'java-library'}, dependencies: [{ group: 'org.springframework', name: 'spring-core', version: '2.5', type: 'runtime', excludes: [] }, { group: 'org.springframework', name: 'spring-core', version: '2.5', type: 'runtime', excludes: [] }, { group: 'org.springframework', name: 'spring-aop', version: '2.5', type: 'org', excludes: [] }, { '': 'org.springframework', name: 'spring-core', version: '2.5]', type: 'group', excludes: [] }, { '': 'org.springframework', name: 'spring-aop', version: '2.5]', type: 'group', excludes: [] }, { group: 'org.hibernate', name: 'hibernate', version: '3.0.5', type: 'runtime', excludes: [] }, { group: 'org.hibernate', name: 'hibernate', version: '3.0.5', transitive: 'true', type: 'runtime', excludes: [] }, { '': 'org.hibernate', name: 'hibernate', version: '3.0.5', type: 'runtime', excludes: [] }], task: {println: 'gradle.gradleHomeDir'}, '': { main: 'Library', classpath: 'sourceSets.main.runtimeClasspath', args: 'mrhaki', systemProperty: '\'simple.message\', \'Hello \'' } }

Issue: Dependency is parsed as below

{ '': 'org.springframework', name: 'spring-core', version: '2.5]', type: 'group', excludes: [] },

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ninetwozero/gradle-to-js/issues/17, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7w0OoSmx3BAATyWR9Oao_ahKy-aPA6ks5t3HuLgaJpZM4UQpfx .

karllindmark commented 6 years ago

Just a quick update - I don't have a computer at hand at the moment, but I'll have access to one sometime this weekend.

Have you had a chance to attempt to fix it? 🙂

Best regards, Karl Lindmark

On Thu, May 31, 2018, 00:42 Karl Lindmark karl.lindmark@ninetwozero.com wrote:

Hi Dilip!

Thanks for the really detailed report - I'll try to take a closer look at it towards the weekend (hopefully!). Lots of things happening in my life right now so I have had a rough time fitting this project in.

If you've got the time and feel like you'd like to contribute this fix, please let me know. Otherwise I'll try to squeeze it into my schedule together with #13. 😊

/Karl

On Tue, May 29, 2018, 00:34 Dilip notifications@github.com wrote:

I was testing and realized that it doesn't work when dependencies are defined as below.

runtime( [group: 'org.springframework', name: 'spring-core', version: '2.5'], [group: 'org.springframework', name: 'spring-aop', version: '2.5'] )

Note: This is sample taken from https://docs.gradle.org/current/userguide/dependency_types.html

Following is complete input

plugins { // Apply the java-library plugin to add support for Java Library id 'java-library' }

dependencies { runtime group: 'org.springframework', name: 'spring-core', version: '2.5' runtime 'org.springframework:spring-core:2.5', 'org.springframework:spring-aop:2.5' runtime( [group: 'org.springframework', name: 'spring-core', version: '2.5'], [group: 'org.springframework', name: 'spring-aop', version: '2.5'] ) runtime('org.hibernate:hibernate:3.0.5') { transitive = true } runtime group: 'org.hibernate', name: 'hibernate', version: '3.0.5', transitive: true runtime(group: 'org.hibernate', name: 'hibernate', version: '3.0.5') { transitive = true } } task getHomeDir << { println gradle.gradleHomeDir }

task(runSimple, dependsOn: 'classes', type: JavaExec) { main = 'Library' classpath = sourceSets.main.runtimeClasspath args 'mrhaki' systemProperty 'simple.message', 'Hello ' }

Following is complete output

{ plugins: {id: 'java-library'}, dependencies: [{ group: 'org.springframework', name: 'spring-core', version: '2.5', type: 'runtime', excludes: [] }, { group: 'org.springframework', name: 'spring-core', version: '2.5', type: 'runtime', excludes: [] }, { group: 'org.springframework', name: 'spring-aop', version: '2.5', type: 'org', excludes: [] }, { '': 'org.springframework', name: 'spring-core', version: '2.5]', type: 'group', excludes: [] }, { '': 'org.springframework', name: 'spring-aop', version: '2.5]', type: 'group', excludes: [] }, { group: 'org.hibernate', name: 'hibernate', version: '3.0.5', type: 'runtime', excludes: [] }, { group: 'org.hibernate', name: 'hibernate', version: '3.0.5', transitive: 'true', type: 'runtime', excludes: [] }, { '': 'org.hibernate', name: 'hibernate', version: '3.0.5', type: 'runtime', excludes: [] }], task: {println: 'gradle.gradleHomeDir'}, '': { main: 'Library', classpath: 'sourceSets.main.runtimeClasspath', args: 'mrhaki', systemProperty: '\'simple.message\', \'Hello \'' } }

Issue: Dependency is parsed as below

{ '': 'org.springframework', name: 'spring-core', version: '2.5]', type: 'group', excludes: [] },

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ninetwozero/gradle-to-js/issues/17, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7w0OoSmx3BAATyWR9Oao_ahKy-aPA6ks5t3HuLgaJpZM4UQpfx .