Figure out debug and release builds #73

Closed
davidfowl opened this Issue Mar 30, 2014 · 11 comments

Projects

None yet

3 participants

@davidfowl
Member

Today we don't have a way to specify debug or release. We need something here.

@Eilon
Member
Eilon commented Mar 30, 2014

Do we want to also thing about the other things that go along with build configurations? E.g. config transformations (not that we necessarily want transformations) to decide/modify/set/unset different config values? E.g. time-outs for things might be longer, or we'd set customErrors=on/off/meme, etc.. Or maybe it's problematic if we conflate a "debug" vs. "release" build with different deployment settings? Anyway I'm just spewing out some thoughts so that I'll remember this when it comes time to discuss.

@davidfowl
Member

Nope, this is mostly about compiler settings. Things you're talking about are in the application layer. Today in VS Debug/Release configuration just means, "use these compiler settings". Right now our project.json pivots on target framework because it maps directly to nuget folders. We don't have a way (neither does nuget), to target debug/release builds within a single nuget package.

@Eilon
Member
Eilon commented Mar 30, 2014

Today in VS debug/release runs web.config.transforms too for Debug/Release, doesn't it?

@davidfowl
Member

Yep, and that's a mistake.

@Eilon
Member
Eilon commented Mar 30, 2014

OK good then we're in agreement 😄

@davidfowl davidfowl added this to the Post Alpha milestone Apr 17, 2014
@davidfowl
Member

Related to #235

@davidfowl davidfowl modified the milestone: 1.0.0-alpha3, Backlog Jun 24, 2014
@davidfowl davidfowl self-assigned this Jun 24, 2014
@davidfowl
Member

I'll take a first pass at this, adding a parameter to build that will allow building debug/release builds.

@davidfowl
Member

Proposal 1:

{
    "frameworks": {
        "net45": {
            "compilationOptions": {
                "define": [ "ALWAYS" ]
            },
            "dependencies": {
                "Newtonsoft.Json": "5.0.8"
            },
            "configurations": {
                "debug": {
                    "compilationOptions": {
                        "define": [ "DEBUG", "TRACE" ],
                        "optimize": false,
                        "debugSymbols": "full"
                    }
                },
                "release": {
                    "compilationOptions": {
                        "define": [ "RELEASE", "TRACE" ],
                        "optimize": true,
                        "debugSymbols": "pdbOnly"
                    }
                }
            }
        }
    }
}

Proposal 2:

{
    "dependencies": { },
    "configurations": {
        "net45": {
            "compilationOptions": {
                "define": [ "ALWAYS" ]
            },
            "dependencies": {
                "Newtonsoft.Json": "5.0.8"
            }
        },
        "net45|debug": {
            "compilationOptions": {
                "define": [ "DEBUG", "TRACE" ],
                "optimize": false,
                "debugSymbols": "full"
            }
        },
        "net45|release": {
            "compilationOptions": {
                "define": [ "RELEASE", "TRACE" ],
                "optimize": true,
                "debugSymbols": "pdbOnly"
            }
        }
    }
}

Proposal 3

{
  "compilationOptions": {
    "define": [ "ALWAYS" ]
  },

  "configurations": {
    "debug": {
      "compilationOptions": {
        "define": [ "DEBUG" ],
         "optimize": false,
         "debugSymbols": "full"
      },
      "release": {
      "compilationOptions": {
        "define": [ "RELEASE" ],
         "optimize": true,
         "debugSymbols": "pdbOnly"
      }
    }
  },

  "frameworks": {
    "net45": {
      "compilationOptions": {
        "define": [ "NET45_ALWAYS" ]
      },

      "configurations": {
        "debug": {
          "compilationOptions": {
            "define": [ "NET45_DEBUG" ]
          }
        }
      }
    }
  }
}

This proposal puts target frameworks into a separate node instead of baking it into the configurations node.

KPM Changes

  • kpm build with accept a -frameworks flag that allows passing in specific frameworks to be built (semicolon separated)
kpm build --framework net45;k10
kpm build --framework net45 --framework k10
  • It will also accept a -configuration flag that will allow passing multiple configurations:
kpm build --framework net45 --configuration debug;release;foo
kpm build --configuration debug --configuration release
  • The same goes for pack
kpm pack --configuration release

K Changes

  • k will have 2 new properties like pack, framework and configuration
k --framework net45 --configuration debug run

Defaults

The roslyn compiler will have known defaults for the debug/release configurations:

Debug:

{
  "compilationOptions": {
    "define": [ "DEBUG", "TRACE" ],
    "optimize": false,
    "debugSymbols": "full"
  }
}

Release

{
  "compilationOptions": {
    "define": [ "RELEASE", "TRACE" ],
    "optimize": true,
    "debugSymbols": "pdbOnly"
  }
}

When doing a regular kpm build, it will default to debug for configurations:

{
  "configurations": { 
    "debug": { },
    "release": { }
  },
  "frameworks": {
    "net45": { },
    "k10": { }
  }
}

kpm build with no arguments will build (net45, debug), (k10, debug).

Open questions:

  1. Do you ever change dependencies depending on debug/release/foo configuration?
@monoman
monoman commented Jul 8, 2014

I prefer proposal 1, to avoid combinatorial explosion, which I currently
observe on csprojs. But 'configurations' inside 'configurations' sound a
bit too repetitive, maybe some other word?

Rafael Teixeira
O..:.)oooo

On Tue, Jul 8, 2014 at 5:46 AM, David Fowler notifications@github.com
wrote:

Proposal 1:

{
"dependencies": {

},
"configurations": {
    "net45": {
        "compilationOptions": {
            "define": [ "ALWAYS" ]
        },
        "dependencies": {
            "Newtonsoft.Json": "5.0.8"
        },
        "configurations": {
            "debug": {
                "compilationOptions": {
                    "define": [ "DEBUG", "TRACE" ],
                    "optimize": false,
                    "debugSymbols": "full"
                }
            },
            "release": {
                "compilationOptions": {
                    "define": [ "RELEASE", "TRACE" ],
                    "optimize": true,
                    "debugSymbols": "pdbOnly"
                }
            }
        }
    }
}}

Proposal 2:

{
"dependencies": { },
"configurations": {
"net45": {
"compilationOptions": {
"define": [ "ALWAYS" ]
},
"dependencies": {
"Newtonsoft.Json": "5.0.8"
}
},
"net45|debug": {
"compilationOptions": {
"define": [ "DEBUG", "TRACE" ],
"optimize": false,
"debugSymbols": "full"
}
},
"net45|release": {
"compilationOptions": {
"define": [ "RELEASE", "TRACE" ],
"optimize": true,
"debugSymbols": "pdbOnly"
}
}
}}

kpm build -framework net45 -configuration debug
kpm pack -framework net45 -configuration debug
k run -framework net45 -configuration debug


Reply to this email directly or view it on GitHub
#73 (comment).

@davidfowl
Member

I'm leaning towards 3

@davidfowl davidfowl added 2 - Working and removed 0 - Backlog labels Jul 9, 2014
@davidfowl davidfowl added 3 - Done and removed 2 - Working labels Jul 11, 2014
@davidfowl davidfowl closed this Jul 14, 2014
@davidfowl
Member

Proposal 3 was implemented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment